<!DOCTYPE html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@taglib prefix="f" uri="http://www.slim3.org/functions"%>
<%@ page import="jp.co.cos.ittrick.channel.model.ChannelModel" %>
<%@ page import="jp.co.cos.ittrick.channel.model.ChapterModel" %>
<%@ page import="jp.co.cos.ittrick.channel.model.PageModel" %>
<%@ page import="jp.co.cos.ittrick.channel.model.PreModel" %>
<%@ page import="jp.co.cos.ittrick.channel.model.ApplicationModel" %>
<%@ page import="java.util.List" %>
<%
	ChannelModel channelModel = (ChannelModel)request.getAttribute("channelModel");
	ChapterModel chapterModel = (ChapterModel)request.getAttribute("chapterModel");
%>
<html lang="ja">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<title>${pageModel.name }-${channelModel.name }：IT TRICK</title>
	<meta name="description" content="${pageModel.description }" />
	<meta name="keywords" content="${pageModel.keyWordListString}" />
	<link rel="icon" type="image/gif" href="/favicon.png" >
	<link rel="alternate" type="application/rss+xml" title="RSS" href="/rss">
	<link href="/css/reset.css" rel="stylesheet" type="text/css" media="screen" />
	<link href="/css/common.css" rel="stylesheet" type="text/css" media="screen" />
	<link href="/css/page.css" rel="stylesheet" type="text/css" media="screen" />
	<link href="/js/google-code-prettify/prettify.css" rel="stylesheet" type="text/css" media="screen" />
	<script src="/js/modernizr-1.1.min.js"></script>
	<script src="/js/google-code-prettify/prettify.js"></script>
</head>
<body>
<!--header-->
	<jsp:include page="/common/header.jsp" />
<!--/header-->

<!--/pankuzuNav-->
	<nav id="pankuzuNav" class="clear">
		<a href="/">${applicationModel.applicationName }</a>&nbsp;&nbsp;&gt;&nbsp;&nbsp;
		<a href="/${channelModel.keyString}.html">${channelModel.name }</a>&nbsp;&nbsp;&gt;&nbsp;&nbsp;
		<a href="/${channelModel.keyString}/c${chapterModel.keyString}.html">${chapterModel.name }</a>&nbsp;&nbsp;&gt;&nbsp;&nbsp;
		${pageModel.name }
	</nav>
<!--/pankuzuNav-->

<!-- contents -->
	<section id="contents" class="clear">
		<div id="contentsHeader">
			<div id="mainTopContent" class="clear">

				<!-- 記事タイトル -->
				<h1>${pageModel.name }</h1>

				<!-- コンテンツ説明 -->
				${pageModel.description }

				<!-- 記事日付 -->
				<div id="pageTime">
					<%
						PageModel pageModel = (PageModel)request.getAttribute("pageModel");
						String thisDateTime = new java.text.SimpleDateFormat( "yyyy-MM-dd", java.util.Locale.US).format(pageModel.getLastmod());
						String thisDateValue = new java.text.SimpleDateFormat( "yyyy年MM月dd日", java.util.Locale.US).format(pageModel.getLastmod());
					%>
						<time datetime="<%=thisDateTime%>"><%=thisDateValue%></time>
				</div>

				<!-- ソーシャルボタン -->
				<jsp:include page="/common/socialBtnList.jsp" />
			</div>

			<div id="mainTopAdvertisement">
				<!-- AdSense -->
				<jsp:include page="/common/adSense/text_image_300_250.jsp" />
				<!-- /AdSense -->
			</div>
		</div>

		<!-- mainContent -->
		<div id="mainContent">
			<div id="mainWrap">
				<div id="mainContentTopAdvertisement">
					<!-- AdSense -->
					<jsp:include page="/common/adSense/link_728_15.jsp" />
					<!-- /AdSense -->
				</div>

				<!-- 記事本文 -->
				<article>
					${pageModel.contentString }
				</article>

				<div id="mainContentFooter">
					<!-- AdSense -->
					<jsp:include page="/common/adSense/text_image_728_90.jsp" />
					<!-- /AdSense -->
				</div>

				<!-- FaceBook Like Box -->
				<jsp:include page="/common/faceBookLikeBox.jsp" />

			</div>

			<aside id="rightWrap">
				<h3>関連コンテンツ</h3>
				<ul>
					<%
						List<PageModel> pageList = chapterModel.getPageModelListRef()
								.getModelList();
						for (PageModel pageObj : pageList) {
							if (pageObj.getPublicFlg()) {
					%>
						<li>
							<a href="/<%=channelModel.getKeyString() %>/c<%=chapterModel.getKeyString() %>/page<%=pageObj.getKeyString() %>.html">
								<span class="title"><%=pageObj.getName() %></span>
							</a>
							<span class="description"><%=pageObj.getDescription() %></span>
						</li>
						<%} %>
					<%} %>
				</ul>

				<!-- profile -->
				<jsp:include page="/common/profile.jsp" />

				<div id="rightWrapAdvertisement300_600">
					<!-- AdSense -->
					<jsp:include page="/common/adSense/text_image_300_600.jsp" />
					<!-- /AdSense -->
				</div>

				<%
				List<PreModel> preModelList = pageModel.getPreModelListRef().getModelList();
				if(preModelList.size() > 0) {
				%>
				<h3>サンプルソース</h3>
				<ul>
					<%
					for(PreModel preModel: preModelList) {
						if(preModel.getDownloadFlg()) {
					%>
					<li>
						<a href="/<%=channelModel.getKeyString() %>/c<%=chapterModel.getKeyString() %>/page<%=pageModel.getKeyString() %>/pre<%=preModel.getKeyString() %>.html">
							<%=preModel.getName() %>
						</a>
					</li>
					<%	}%>
					<%} %>
				</ul>
				<%} %>
			</aside>
		</div>
	</section>
<!-- /contents -->

<!---footer-->
	<jsp:include page="/common/footer.jsp" />
<!--/footer-->

<!---prettyPrint-->
<script type="text/javascript">prettyPrint();</script>
<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) {return;}
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/ja_JP/all.js#xfbml=1";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<!---/prettyPrint-->

</body>
</html>
